package erfgame.core;

public abstract class SimpleAbstractOperation<K,E extends Throwable> extends AbstractOperation<K, E> {
	
	public SimpleAbstractOperation( String name ) {
		super( new OperationProgress(0,1,name) );
	}
	
	public K perform() throws E {
		this.setProgress(new OperationProgress(0, 1, this.getProgress().getName()));
		K result = doPerform();
		this.setProgress(new OperationProgress(1, 1, this.getProgress().getName()));
		return result;
	}
	
	protected abstract K doPerform() throws E;
}
